home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sprite 1984 - 1993
/
Sprite 1984 - 1993.iso
/
src
/
boot
/
netBoot.new
/
main.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-12-19
|
2KB
|
79 lines
/*-
* main.c --
* First-level boot program for Sprite. Takes its arguments
* and uses tftp to download the appropriate kernel image.
*
* Copyright (c) 1987 by the Regents of the University of California
*
* Permission to use, copy, modify, and distribute this
* software and its documentation for any purpose and without
* fee is hereby granted, provided that the above copyright
* notice appear in all copies. The University of California
* makes no representations about the suitability of this
* software for any purpose. It is provided "as is" without
* express or implied warranty.
*
*
*/
#ifndef lint
static char rcsid[] =
"$Header: /sprite/src/boot/netBoot/RCS/main.c,v 1.1 90/10/10 15:13:28 jhh Exp Locker: jhh $ SPRITE (Berkeley)";
#endif lint
#include "boot.h"
#include "saio.h"
#include "bootparam.h"
/*-
*-----------------------------------------------------------------------
* main --
* Main function for downloading stuff.
*
* Results:
* None.
*
* Side Effects:
* Begins the booted program.
*
*-----------------------------------------------------------------------
*/
main()
{
register struct bootparam *bp = *romp->v_bootparam;
struct saioreq req;
int startAddr;
if ((strcmp(bp->bp_name, "vmunix") == 0) || (*bp->bp_name == '\0')) {
bp->bp_name = BOOT_FILE;
}
printf ("SpriteBoot: %c%c(%x,%x,%x)%s\n",
bp->bp_dev[0], bp->bp_dev[1], bp->bp_ctlr,
bp->bp_unit, bp->bp_part, bp->bp_name);
req.si_ctlr = bp->bp_ctlr;
req.si_unit = bp->bp_unit;
req.si_boff = (daddr_t)bp->bp_part;
req.si_boottab = bp->bp_boottab;
if (devopen(&req)) { /* Do all the hard work */
(*romp->v_exit_to_mon)();
}
etheropen( &req);
startAddr = tftpload(&req, bp);
devclose(&req);
if (startAddr == -1){
(*romp->v_exit_to_mon)();
} else {
/*
* Jump to the address returned by tftpload
*/
printf("Starting execution at 0x%x\n", startAddr);
startKernel(startAddr);
return(startAddr);
}
}